import { ref } from "vue"

const useModal = <T = any>() => {

  let visible = ref(false)


  function openModal() {
    visible.value = true
  }

  function closeModal() {
    visible.value = false
  }

  let modalValue = ref<T>()
  function setModalValue(data: T) {
    modalValue.value = data
  }

  return {
    visible,
    openModal,
    closeModal,
    modalValue,
    setModalValue
  }
}
export default useModal